package HP.p0812.XunHuan7;

/**
 * 7、某个公司采用公用电话传递数据，数据是四位的整数，在传递过程中是加密的，加密规则如下：每位数字都加上5,然后用和除以10的余数代替该数字，再将第一位和第四位交换，第二位和第三位交换。
 */
public class JiaMi {
    public static void main(String[] args) {
        int call = 1234;

        int qian = call / 1000;
        int bai = call / 100 % 10;
        int shi = call / 10 % 10;
        int ge = call % 10;
/*      System.out.println(call/1000);//千
        System.out.println(call%10);//个
        System.out.println(call/10%10);//十
        System.out.println(call/100%10);//百*/

        qian = (qian + 5) % 10;
        bai = (bai + 5) % 10;
        shi = (shi + 5) % 10;
        ge = (ge + 5) % 10;

        int temp = qian;
        qian = ge;
        ge = temp;
        temp = bai;
        bai = shi;
        shi = temp;
/*        System.out.println("qian = " + qian);
        System.out.println("bai = " + bai);
        System.out.println("shi = " + shi);
        System.out.println("ge = " + ge);*/
        System.out.println("加密后:" + qian + bai + shi + ge);
    }
}
